package com.ah.shanxi_demo.model;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

/**
 * 描述:
 * 封装msg和result的容器，共外界使用。
 *
 * @author guazi
 * @create 2018-04-19 9:43
 */
@Setter
@Getter
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(value = JsonInclude.Include.NON_NULL)
@NoArgsConstructor
public class MsgResultBoxModel {

    /**
     *  code.
     */
    private Integer code;

    /**
     *  message.
     */
    private String message;

    /**
     *  data.
     */
    private Object data;

    /**
     *  total.
     */
    private Integer total;

    /**
     *  haveNext.
     */
    private Boolean haveNext;


    public MsgResultBoxModel(Integer code, String msg, Object result) {
        this(code, msg, result, null, null);
    }


    public MsgResultBoxModel(Integer code, String msg, Object result, Integer total) {
        this.code = code;
        this.message = msg;
        this.data = result;
        this.total = total;
    }

    public MsgResultBoxModel(Integer code, String msg, Object result, Boolean haveNext) {
        this.code = code;
        this.message = msg;
        this.data = result;
        this.haveNext = haveNext;
    }

    public MsgResultBoxModel(Integer code, String msg, Object result, Integer total, Boolean haveNext) {
        this.code = code;
        this.message = msg;
        this.data = result;
        this.total = total;
        this.haveNext = haveNext;
    }

    public MsgResultBoxModel code(final Integer code) {
        this.code = code;
        return this;
    }

    public MsgResultBoxModel message(final String message) {
        this.message = message;
        return this;
    }

    public MsgResultBoxModel data(final Object data) {
        this.data = data;
        return this;
    }

    public MsgResultBoxModel total(final Integer total) {
        this.total = total;
        return this;
    }

    public MsgResultBoxModel haveNext(final Boolean haveNext) {
        this.haveNext = haveNext;
        return this;
    }

}
